//
// Created by 86155 on 2025/7/4.
//

#include "FeDataCtrl.h"
#include "stdio.h"
FeDataCtrl dataCtrl;
FeDataCtrl::FeDataCtrl() {
}

void FeDataCtrl::setData(){
  printf("setData\n");
  for (int i = 0; i < 50; ++i) {
    mem[i] = i;
    inbuffer[2 * i] = 0;
    inbuffer[2 * i + 1] = 0;
    outbuffer[2 * i] = 0;
    outbuffer[2 * i + 1] = 0;
  }
}

void FeDataCtrl::insdin(int rs1,int rs4){
  for (int i = 0; i < rs4; ++i) {
    inbuffer[rs1 + i] = mem[i];
  }
}

void FeDataCtrl::insdout(int rs1,int rs4){
  for (int i = 0; i < rs4; ++i) {
    mem[rs1 + i] = outbuffer[rs1 + i];
  }
}

void FeDataCtrl::insrac(int rs1,int rs4){
  RAC = 0;
  for (int i = 0; i < rs4; ++i) {
    RAC += inbuffer[rs1 + i];
  }
}

void FeDataCtrl::displayInbufferData(){
  printf("inbuffer:\n");
  for(int i = 0; i < 100; i++){
    printf("%d ",inbuffer[i]);
    if((i+1)%10==0){
      printf("\n");
    }
  }
  printf("\n");
}
void FeDataCtrl::displayOutbufferData(){
  printf("outbuffer:\n");
  for(int i = 0; i < 100; i++){
    printf("%d ",outbuffer[i]);
    if((i+1)%10==0){
      printf("\n");
    }
  }
  printf("\n");
}
void FeDataCtrl::displaymemData(){
  printf("mem:\n");
  for(int i = 0; i < 50; i++){
    printf("%d ",mem[i]);
    if((i+1)%10==0){
      printf("\n");
    }
  }
  printf("\n");
}
extern FeDataCtrl dataCtrl;
